import {useEffect} from 'react';
import wx from "../image/Cart/wx.png"
import {useSelector} from "react-redux"
import {useLocation,useHistory} from "react-router-dom"
// import { Button, Space, Toast } from "antd-mobile";

function Playsuccess() {
    const {replace,push} =useHistory()
    const {state} =useLocation()
    let {order} =useSelector((store=>store)) 
    order =order.find(item=>item.id==state.id)
    if(!order){
        push("/Cart")
        return null
    }
  return (
    <div className="playsuccess">
      <div className="incon">
        <img src={wx} alt="" />
        <br />
        <span>支付成功</span>
      </div>
      <div className="money">
        <p className="name">小米责任有限公司</p>
        <p className="price">￥{order.money}</p>
      </div>
      <div className="return"
        onClick={()=>{
            replace({ pathname: "/Cart/resolvd",state:{id:state.id} });
        }}
      >返回商家</div>
    </div>
  );
}

export default Playsuccess;
